/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.GUI.setting;

import ac.ui.controls.PCLPanel;
import ac.uitls.propertiesOperation;
import java.awt.Color;

/**
 *
 * @author ismail
 */
public class styleSetting extends PCLPanel {

    /**
     * Creates new form genSetting
     */
    ac.ui.custemItmes c = new ac.ui.custemItmes();
    ac.ui.utils u = new ac.ui.utils();
    propertiesOperation po = new propertiesOperation();
    ac.engin.setting.styleSetting gs = new ac.engin.setting.styleSetting();

    public styleSetting() {
        initComponents();
        onLoad();
        mLoad();
    }

    private void mLoad() {

        // u.panelupdateLabels(this.getComponents());
        String[] stylet = {"default"};
        String[] styletv = {"default"};
        c.comBoxFill(style_cb, stylet, styletv);

        ac.ui.custemItmes.comBoxSetSelectonByValue(style_cb, gs.getGenSetting()[1]);

        jtxt_infoValuesColor.setBackground(Color.decode("#" + gs.getGenSetting()[0]));

        jtxt_infoValuesColor.setText(gs.getGenSetting()[0]);

        jtxt_infoLabelColor.setBackground(Color.decode("#" + gs.getGenSetting()[2]));

        jtxt_infoLabelColor.setText(gs.getGenSetting()[2]);
 jtxt_requiredBackground.setBackground(Color.decode("#" + gs.getGenSetting()[3]));

        jtxt_requiredBackground.setText(gs.getGenSetting()[3]);
        
        
        
        
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jToolBar2 = new javax.swing.JToolBar();
        update_bt = new javax.swing.JButton();
        default_bt = new javax.swing.JButton();
        style_lb = new javax.swing.JLabel();
        style_cb = new javax.swing.JComboBox();
        jtxt_infoValuesColor = new ac.ui.controls.PCLColor();
        style_lb1 = new javax.swing.JLabel();
        jtxt_infoLabelColor = new ac.ui.controls.PCLColor();
        style_lb2 = new javax.swing.JLabel();
        jtxt_requiredBackground = new ac.ui.controls.PCLColor();
        style_lb3 = new javax.swing.JLabel();

        jLabel1.setText("jLabel1");

        jToolBar2.setRollover(true);

        update_bt.setText("bt_update");
        update_bt.setFocusable(false);
        update_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        update_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        update_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                update_btActionPerformed(evt);
            }
        });
        jToolBar2.add(update_bt);

        default_bt.setText("bt_default");
        default_bt.setFocusable(false);
        default_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        default_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        default_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                default_btActionPerformed(evt);
            }
        });
        jToolBar2.add(default_bt);

        style_lb.setText("lb_style");

        style_cb.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "default" }));

        style_lb1.setText("lb_infoValueColor");

        jtxt_infoLabelColor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtxt_infoLabelColorActionPerformed(evt);
            }
        });

        style_lb2.setText("lb_jtxt_infoLabelColor");

        jtxt_requiredBackground.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtxt_requiredBackgroundActionPerformed(evt);
            }
        });

        style_lb3.setText("jlb_requiredBackground");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(style_lb)
                    .addComponent(style_lb1)
                    .addComponent(style_lb2)
                    .addComponent(style_lb3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jtxt_requiredBackground, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtxt_infoLabelColor, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtxt_infoValuesColor, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(style_cb, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(19, 19, 19)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(style_lb)
                    .addComponent(style_cb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxt_infoValuesColor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(style_lb1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxt_infoLabelColor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(style_lb2))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxt_requiredBackground, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(style_lb3))
                .addContainerGap(130, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void update_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_update_btActionPerformed
        // TODO add your handling code here:
        String[] items = {jtxt_infoValuesColor.getText(), (String) ac.ui.custemItmes.comBoxGetValue(style_cb), jtxt_infoLabelColor.getText()   , jtxt_requiredBackground.getText()                   };

        u.sendMessage(this, po.getWord("label.saveUpdate"), gs.updateSetting(items));

ac.GUI.index.updatecolors();
    }//GEN-LAST:event_update_btActionPerformed

    private void default_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_default_btActionPerformed

        u.sendMessage(this, po.getWord("label.saveUpdate"), gs.defSetting());
    }//GEN-LAST:event_default_btActionPerformed

    private void jtxt_infoLabelColorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtxt_infoLabelColorActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jtxt_infoLabelColorActionPerformed

    private void jtxt_requiredBackgroundActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtxt_requiredBackgroundActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jtxt_requiredBackgroundActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton default_bt;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JToolBar jToolBar2;
    private ac.ui.controls.PCLColor jtxt_infoLabelColor;
    private ac.ui.controls.PCLColor jtxt_infoValuesColor;
    private ac.ui.controls.PCLColor jtxt_requiredBackground;
    private javax.swing.JComboBox style_cb;
    private javax.swing.JLabel style_lb;
    private javax.swing.JLabel style_lb1;
    private javax.swing.JLabel style_lb2;
    private javax.swing.JLabel style_lb3;
    private javax.swing.JButton update_bt;
    // End of variables declaration//GEN-END:variables
}
